package Test3;

import java.math.BigDecimal;

/**
 * 有以下学员信息：
 * 		张三,男,20,79.5
 * 		李四,女,21,80.2
 * 		王五,男,22,77.9
 * 		周六,男,20,55.8
 * 		赵七,女,21,99.9
 * 	请定义学员类，属性：姓名、性别、年龄、分数
 * 	请编写测试类，创建5个对象，分别存储上述值，
 * 	并计算5名学员的“平均分”(四舍五入到小数点后2位)。
 */

public class TestStudent1 {
    public static void main(String[] args) {
        Student1 s1 = new Student1("张三", "男", 20, 79.5);
        Student1 s2 = new Student1("李四", "男", 21, 80.2);
        Student1 s3 = new Student1("王五", "男", 22, 77.9);
        Student1 s4 = new Student1("周六", "男", 20, 55.8);
        Student1 s5 = new Student1("赵七", "男", 21, 99.9);
        double sum = 0;
        sum = s1.getScore() + s2.getScore() + s3.getScore() + s4.getScore() + s5.getScore();
        BigDecimal bigDecimal = new BigDecimal(sum);
        BigDecimal bigDecimal1 = new BigDecimal(5);
        BigDecimal divide = bigDecimal.divide(bigDecimal1, 2, BigDecimal.ROUND_HALF_UP);
        System.out.println(divide);
    }
}
